package com.cea.papyrus.diagram.sequence.ui.dialogs;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.uml2.uml.Message;
import org.eclipse.uml2.uml.Operation;

import com.cea.papyrus.core.PapyrusPlugin;
import com.cea.papyrus.diagram.sequence.ui.filters.OperationFilter;
import com.cea.papyrus.diagram.sequence.ui.validators.MessageOperationSelectionStatusValidator;

public class MessageOperationTreeSelectionDialog extends ElementTreeSelectionDialog {

	public MessageOperationTreeSelectionDialog(
			Shell parent, 
			LabelProvider labelProvider, 
			ITreeContentProvider contentProvider, 
			Message message) {
		
		super(parent, labelProvider, contentProvider);
		
		this.setImage(PapyrusPlugin.UML_LABEL_PROVIDER.getImage(Operation.class, null));
		this.setHelpAvailable(false);
		this.setAllowMultiple(false);
		
		this.setTitle("Select an operation :");

		this.setValidator(new MessageOperationSelectionStatusValidator(message));
		this.addFilter(new OperationFilter());
	}
}